package com.huawei.esdk.tp.device.smc;

import org.apache.log4j.Logger;

import com.huawei.esdk.platform.commu.itf.ICXFSOAPProtocolAdapter;
import com.huawei.esdk.platform.exception.ProtocolAdapterException;

public abstract class BaseCapability
{
    private static final Logger LOGGER = Logger.getLogger(BaseCapability.class);

    protected ICXFSOAPProtocolAdapter cxfSOAPProtocolAdapter;

    public BaseCapability(ICXFSOAPProtocolAdapter cxfSOAPProtocolAdapter)
    {
        LOGGER.debug("BaseCapability() is called");
        this.cxfSOAPProtocolAdapter = cxfSOAPProtocolAdapter;
    }
    
    /**
     * 
     * @param requestMessage : 南向请求消息
     * @param srcMethod : 请求消息名称
     * @return ： 南向返回消息
     * @throws ProtocolAdapterException 
     */
    @SuppressWarnings("unchecked")
    public <T1> T1 sendProtocolMessage(Object requestMessage,String southItfName,String srcMethod) throws ProtocolAdapterException
    {
        // send message to SMC
        T1 res = (T1) cxfSOAPProtocolAdapter
                    .syncSendMessageWithCxf(
                            requestMessage,
                            southItfName,
                            srcMethod);
        return res;
    }
}
